﻿using System;
using System.Collections;
using System.Collections.Generic;

using Wsitech.Model;
using Wsitech.Persistence.Interface;

namespace Wsitech.Persistence.Dao
{
	/// <summary>
	/// 功能：     UserRoleRela业务接口的实现
	/// 作者：     LI
 	/// 日期：     5/16/2012
 	/// 修改日期： 
 	/// 修改人：
 	/// 修改内容：
	/// </summary>
	public class UserRoleRelaSqlMapDao : BaseSqlMapDao,IUserRoleRelaDao
	{
		private UserRoleRelaSqlMapDao ()
		{
			//
			// TODO: 此处添加UserRoleRelaSqlMapDao的构造函数
			//
		}
		
		#region 懒汉单例模式
		
		private static UserRoleRelaSqlMapDao instance =null;
		private static object syncRoot = new object();
		public static IUserRoleRelaDao Instance
        {
            get 
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                        {
                            instance = new UserRoleRelaSqlMapDao();
                        }
                    }
                }
                return instance;
            }
        }
		
		#endregion
		
		#region	基本功能 ，不可修改
		
		/// <summary>
		/// 得到明细
		/// </summary>
		/// <param name="RelaID"></param>
		/// <returns></returns>
		public UserRoleRela GetDetail(System.String relaid)
		{
			try
			{
				return ExecuteQueryForObject< UserRoleRela>("SelectUserRoleRela",relaid) as UserRoleRela;
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 得到列表
		/// </summary>
		/// <returns></returns>
		public System.Collections.Generic.IList< UserRoleRela> GetList()
		{
			try
			{
				return ExecuteQueryForList< UserRoleRela>("SelectUserRoleRela",null);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 通过不同参数得到列表
		/// </summary>
		/// <param name="objParameters"></param>
		/// <returns></returns>
		public System.Collections.Generic.IList< UserRoleRela> GetListByParams(object objParameters)
		{
			try
			{
				return ExecuteQueryForList< UserRoleRela>("SelectUserRoleRelaByParams",objParameters);
			}
            catch
            {
                throw;
            }
		}
		
		
		
		/// <summary>
        /// 新建
        /// </summary>
        /// <param name="userrolerela"></param>
        /// <returns></returns>
		public object Add(UserRoleRela userrolerela)
		{
			//int id = GetId("UserRoleRela");
			//userrolerela.RelaID = id;
			
			try
			{
				return ExecuteInsert("InsertUserRoleRela",userrolerela);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
        /// 修改
        /// </summary>
        /// <param name="userrolerela"></param>
        /// <returns></returns>
		public int Update(UserRoleRela userrolerela)
		{
			try
			{
				return ExecuteUpdate("UpdateUserRoleRela",userrolerela);
			}
            catch
            {
                throw;
            }			
		}

		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="RelaID"></param>
		/// <returns></returns>
		public int Delete(System.String relaid)
		{
			try
			{
				return ExecuteDelete("DeleteUserRoleRela",relaid);
			}
            catch
            {
                throw;
            }
		}
		#endregion
		
		#region 扩展功能
		
		#endregion
	}
}
